def searchInsert(nums, target):
    # 简单的一个方法是遍历一下数组
    for i in range(len(nums)):
        if nums[i] >= target:
            return i
    return i+1


# 后面要二分查找了
def searchInsert(nums, target):
    # 简单的一个方法是遍历一下数组
    left = 0
    right = len(nums) - 1
    while left <= right:
        mid = (left + right) // 2
        if nums[mid] < target:
            left = mid + 1
        elif nums[mid] > target:
            right = mid - 1
        else:
            return mid
    return left




print(searchInsert([1,2,3,4,5,6],7))